import 'package:get/get.dart';
import '../screens/auth/account_locked_page.dart';
import '../screens/auth/force_update_page.dart';
import '../screens/main/main_page.dart';
import '../screens/plans/running_plans_page.dart';
import '../screens/auth/startup_auth_page.dart';
import '../screens/wallet/records_detail_page.dart';
import '../screens/wallet/withdraw_page.dart';
import '../widgets/web_view_page.dart';
import 'auth_middleware.dart';

abstract class AppRoutes {
  static const String startupAuth = '/startup-auth'; // 新增启动认证页面
  static const String accountLocked = '/account-locked'; // 账户锁定页面
  static const String forceUpdate = '/force-update'; // 强制更新页面
  static const String root = '/';
  static const String home = '/home';
  static const String wallet = '/wallet';
  static const String referral = '/referral';
  static const String help = '/help';
  static const String login = '/login';
  static const String register = '/register';
  static const String webview = '/webview';
  static const String recordsDetail = '/records-detail'; // 交易记录详情页面
  static const String runningPlans = '/running-plans'; // 运行中计划页面
  static const String withdraw = '/withdraw'; // 提现页面
}

class RouteManger {
  static final List<GetPage> routes = [
      GetPage(
      name: AppRoutes.startupAuth,
      page: () => StartupAuthPage(),
    ),
    
    // 账户锁定页面
    GetPage(
      name: AppRoutes.accountLocked,
      page: () => AccountLockedPage(),
    ),
    
    // 强制更新页面
    GetPage(
      name: AppRoutes.forceUpdate,
      page: () => ForceUpdatePage(),
    ),
    // 主页面（直接进入main_page）
    GetPage(
      name: AppRoutes.root,
      page: () => MainPage(),
    ),
    
    // 首页（不需要登录）
    GetPage(
      name: AppRoutes.home,
      page: () => MainPage(),
    ),
    
    // 钱包页面（需要登录）
    // GetPage(
    //   name: AppRoutes.wallet,
    //   page: () => WalletPage(),
    //   middlewares: [AuthMiddleware()],
    // ),


    //  GetPage(
    //   name: AppRoutes.referral,
    //   page: () => ReferralPage(),
    //   middlewares: [AuthMiddleware()],
    // ),

    
    
    // 帮助页面（需要登录）
    // GetPage(
    //   name: AppRoutes.help,
    //   page: () => HelpPage(),
    //   middlewares: [AuthMiddleware()],
    // ),

   GetPage(
  name: AppRoutes.webview,
  page: () => WebViewPage(
    url: Get.parameters['url'] ?? '',
    title: Get.parameters['title'] ?? '',
  ),
),

    // 交易记录详情页面（需要登录）
    GetPage(
      name: AppRoutes.recordsDetail,
      page: () => RecordsDetailPage(),
      middlewares: [AuthMiddleware()],
    ),
    
    // 运行中计划页面（需要登录）
    GetPage(
      name: AppRoutes.runningPlans,
      page: () => RunningPlansPage(),
      middlewares: [AuthMiddleware()],
    ),
    
    // 提现页面（需要登录）
    GetPage(
      name: AppRoutes.withdraw,
      page: () => WithdrawPage(),
      middlewares: [AuthMiddleware()],
    ),
    
  ];
}